package mallindex

import (
	"context"

	// "mall/common/jwt"
	// "mall/common/result"
	"mall/common/utils/pointy"
	"mall/service/forum/api/internal/svc"
	"mall/service/forum/api/internal/types"
	// "mall/service/user/rpc/userclient"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetSiteGoodsDynamicListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGetSiteGoodsDynamicListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSiteGoodsDynamicListLogic {
	return &GetSiteGoodsDynamicListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *GetSiteGoodsDynamicListLogic) GetSiteGoodsDynamicList(
	req *types.GetSiteGoodsDynamicListReq,
	headers *[]*types.Header,
) (resp *types.SiteGoodsDynamicListResp, err error) {
	// userId := jwt.GetUserId(l.ctx)

	resp = &types.SiteGoodsDynamicListResp{
		BaseListInfo: types.BaseListInfo{
			Current:         uint64(1),
			PageSize:        uint64(10),
			HasNextPage:     false,
			HasPreviousPage: false,
		},
	}

	resp.List = append(resp.List, &types.SiteGoodsDynamicInfo{
		Id:       pointy.GetPointer(uint64(1)),
		ImageUrl: pointy.GetPointer("https://pic2.zhimg.com/v2-e033e648185aac42580219b7fad9ed08_r.jpg"),
		Content:  pointy.GetPointer("廖娜 购买了 兔毛马甲"),
	})
	resp.List = append(resp.List, &types.SiteGoodsDynamicInfo{
		Id:       pointy.GetPointer(uint64(2)),
		ImageUrl: pointy.GetPointer("https://img9.doubanio.com/icon/up244162210-4.jpg"),
		Content:  pointy.GetPointer("林杰 购买了 男童风衣"),
	})
	resp.List = append(resp.List, &types.SiteGoodsDynamicInfo{
		Id:       pointy.GetPointer(uint64(3)),
		ImageUrl: pointy.GetPointer("https://p7.itc.cn/images01/20210427/296d49e32eca4565821bbe34b2e2b315.jpeg"),
		Content:  pointy.GetPointer("方明 购买了 貂绒毛衣"),
	})
	resp.List = append(resp.List, &types.SiteGoodsDynamicInfo{
		Id:       pointy.GetPointer(uint64(4)),
		ImageUrl: pointy.GetPointer("https://pic1.zhimg.com/v2-8c39c9300bc6535fdb058118a06ca730_b.jpg"),
		Content:  pointy.GetPointer("廖强 购买了 夹克外套"),
	})

	return resp, nil
}
